package t04;

/**
 * @author zhu
 * @date 2024-04-11
 */
public class ManTest {
    public static Student build(String name,
                                int age,
                                StudentBuilder sb){
        return sb.create(name, age);
    }

    public static void main(String[] args) {
        Student stu1 = build("张三", 18, new StudentBuilder() {
            @Override
            public Student create(String name, int age) {
                return new Student(name, age);
            }
        });
        System.out.println(stu1);

        Student stu2 = build("李四",19,(name,age) -> {
            return new Student(name, age);
        });
        System.out.println(stu2);

        Student stu3 = build("王五",20,Student::new);
        System.out.println(stu3);
    }
}
